package service

import (
	"gitee.com/fierce_wolf/go-fox-edge-common/commConfig"
	"gitee.com/fierce_wolf/go-fox-edge-common/commLogger"
	"gitee.com/fierce_wolf/go-fox-edge-common/commUtil/Map"
)

type fastBeeService struct {
	TimeInterval int
	TimeUnit     string
	ProductId    string
	DeviceNum    string
	IotName      string
	SubsetName   string
}

func (e *fastBeeService) initialize() {
	// 获得系统配置参数
	configValue, err := commConfig.GetConfigParam("serverConfig")
	if err != nil {
		commLogger.Error("获取serverConfig参数失败：" + err.Error())
		return
	}

	// 取出系统配置参数
	fastbee := Map.GetMap(configValue, "fastbee", make(map[string]interface{}))

	e.IotName = Map.GetString(fastbee, "iotName", "FastBee")
	e.SubsetName = Map.GetString(fastbee, "subsetName", "default")
	e.ProductId = Map.GetString(fastbee, "productId", "productId")
	e.DeviceNum = Map.GetString(fastbee, "deviceNum", "deviceNum")
	e.TimeUnit = Map.GetString(fastbee, "timeUnit", "minute")
	e.TimeInterval = Map.GetInt(fastbee, "timeInterval", 300)
}
